package com.tjbklx1.thread.chap02.practise03;

public class Main {

	public static final long CALL_COUNT = 10000000000L;

	public static void main(String[] args) {
		trial("NoSynch", CALL_COUNT, new NoSynch());
		trial("Synch", CALL_COUNT, new Synch());
	}

	private static void trial(String message, long count, Object obj) {
		System.out.println(message + ": BEGIN");
		long startTime = System.currentTimeMillis();
		for (long i = 0; i < count; i++) {
			obj.toString();
		}
		System.out.println(message + ": END");
		System.out.println("Elapsed time ="
				+ (System.currentTimeMillis() - startTime));
	}
}
